1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is the Netscape Portable Runtime (NSPR).
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998-2000
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nspr_cpucfg___
39 #define nspr_cpucfg___
53 #define PR_AF_INET6 23 /* same as AF_INET6 */
55 #if defined(_M_IX86) || defined(_X86_)
57 #define IS_LITTLE_ENDIAN 1
60 #define PR_BYTES_PER_BYTE 1
61 #define PR_BYTES_PER_SHORT 2
62 #define PR_BYTES_PER_INT 4
63 #define PR_BYTES_PER_INT64 8
64 #define PR_BYTES_PER_LONG 4
65 #define PR_BYTES_PER_FLOAT 4
66 #define PR_BYTES_PER_WORD 4
67 #define PR_BYTES_PER_DWORD 8
68 #define PR_BYTES_PER_DOUBLE 8
70 #define PR_BITS_PER_BYTE 8
71 #define PR_BITS_PER_SHORT 16
72 #define PR_BITS_PER_INT 32
73 #define PR_BITS_PER_INT64 64
74 #define PR_BITS_PER_LONG 32
75 #define PR_BITS_PER_FLOAT 32
76 #define PR_BITS_PER_WORD 32
77 #define PR_BITS_PER_DWORD 64
78 #define PR_BITS_PER_DOUBLE 64
80 #define PR_BITS_PER_BYTE_LOG2 3
81 #define PR_BITS_PER_SHORT_LOG2 4
82 #define PR_BITS_PER_INT_LOG2 5
83 #define PR_BITS_PER_INT64_LOG2 6
84 #define PR_BITS_PER_LONG_LOG2 5
85 #define PR_BITS_PER_FLOAT_LOG2 5
86 #define PR_BITS_PER_WORD_LOG2 5
87 #define PR_BITS_PER_DWORD_LOG2 6
88 #define PR_BITS_PER_DOUBLE_LOG2 6
90 #define PR_ALIGN_OF_SHORT 2
91 #define PR_ALIGN_OF_INT 4
92 #define PR_ALIGN_OF_LONG 4
93 #define PR_ALIGN_OF_INT64 8
94 #define PR_ALIGN_OF_FLOAT 4
95 #define PR_ALIGN_OF_WORD 4
96 #define PR_ALIGN_OF_DWORD 8
97 #define PR_ALIGN_OF_DOUBLE 4
98 #define PR_ALIGN_OF_POINTER 4
100 #define PR_BYTES_PER_WORD_LOG2 2
101 #define PR_BYTES_PER_DWORD_LOG2 2
103 #elif defined(_ALPHA_)
105 #define IS_LITTLE_ENDIAN 1
108 #define PR_BYTES_PER_BYTE 1
109 #define PR_BYTES_PER_SHORT 2
110 #define PR_BYTES_PER_INT 4
111 #define PR_BYTES_PER_INT64 8
112 #define PR_BYTES_PER_LONG 4
113 #define PR_BYTES_PER_FLOAT 4
114 #define PR_BYTES_PER_DOUBLE 8
115 #define PR_BYTES_PER_WORD 4
116 #define PR_BYTES_PER_DWORD 8
118 #define PR_BITS_PER_BYTE 8
119 #define PR_BITS_PER_SHORT 16
120 #define PR_BITS_PER_INT 32
121 #define PR_BITS_PER_INT64 64
122 #define PR_BITS_PER_LONG 32
123 #define PR_BITS_PER_FLOAT 32
124 #define PR_BITS_PER_DOUBLE 64
125 #define PR_BITS_PER_WORD 32
127 #define PR_BITS_PER_BYTE_LOG2 3
128 #define PR_BITS_PER_SHORT_LOG2 4
129 #define PR_BITS_PER_INT_LOG2 5
130 #define PR_BITS_PER_INT64_LOG2 6
131 #define PR_BITS_PER_LONG_LOG2 5
132 #define PR_BITS_PER_FLOAT_LOG2 5
133 #define PR_BITS_PER_DOUBLE_LOG2 6
134 #define PR_BITS_PER_WORD_LOG2 5
136 #define PR_BYTES_PER_WORD_LOG2 2
137 #define PR_BYTES_PER_DWORD_LOG2 3
139 #define PR_ALIGN_OF_SHORT 2
140 #define PR_ALIGN_OF_INT 4
141 #define PR_ALIGN_OF_LONG 4
142 #define PR_ALIGN_OF_INT64 8
143 #define PR_ALIGN_OF_FLOAT 4
144 #define PR_ALIGN_OF_DOUBLE 8
145 #define PR_ALIGN_OF_POINTER 4
147 #elif defined(_AMD64_)
149 #define IS_LITTLE_ENDIAN 1
153 #define PR_BYTES_PER_BYTE 1
154 #define PR_BYTES_PER_SHORT 2
155 #define PR_BYTES_PER_INT 4
156 #define PR_BYTES_PER_INT64 8
157 #define PR_BYTES_PER_LONG 4
158 #define PR_BYTES_PER_FLOAT 4
159 #define PR_BYTES_PER_WORD 8
160 #define PR_BYTES_PER_DWORD 8
161 #define PR_BYTES_PER_DOUBLE 8
163 #define PR_BITS_PER_BYTE 8
164 #define PR_BITS_PER_SHORT 16
165 #define PR_BITS_PER_INT 32
166 #define PR_BITS_PER_INT64 64
167 #define PR_BITS_PER_LONG 32
168 #define PR_BITS_PER_FLOAT 32
169 #define PR_BITS_PER_WORD 64
170 #define PR_BITS_PER_DWORD 64
171 #define PR_BITS_PER_DOUBLE 64
173 #define PR_BITS_PER_BYTE_LOG2 3
174 #define PR_BITS_PER_SHORT_LOG2 4
175 #define PR_BITS_PER_INT_LOG2 5
176 #define PR_BITS_PER_INT64_LOG2 6
177 #define PR_BITS_PER_LONG_LOG2 5
178 #define PR_BITS_PER_FLOAT_LOG2 5
179 #define PR_BITS_PER_WORD_LOG2 6
180 #define PR_BITS_PER_DWORD_LOG2 6
181 #define PR_BITS_PER_DOUBLE_LOG2 6
183 #define PR_ALIGN_OF_SHORT 2
184 #define PR_ALIGN_OF_INT 4
185 #define PR_ALIGN_OF_LONG 4
186 #define PR_ALIGN_OF_INT64 8
187 #define PR_ALIGN_OF_FLOAT 4
188 #define PR_ALIGN_OF_WORD 8
189 #define PR_ALIGN_OF_DWORD 8
190 #define PR_ALIGN_OF_DOUBLE 8
191 #define PR_ALIGN_OF_POINTER 8
193 #define PR_BYTES_PER_WORD_LOG2 3
194 #define PR_BYTES_PER_DWORD_LOG2 3
196 #elif defined(_IA64_)
198 #define IS_LITTLE_ENDIAN 1
202 #define PR_BYTES_PER_BYTE 1
203 #define PR_BYTES_PER_SHORT 2
204 #define PR_BYTES_PER_INT 4
205 #define PR_BYTES_PER_INT64 8
206 #define PR_BYTES_PER_LONG 4
207 #define PR_BYTES_PER_FLOAT 4
208 #define PR_BYTES_PER_WORD 8
209 #define PR_BYTES_PER_DWORD 8
210 #define PR_BYTES_PER_DOUBLE 8
212 #define PR_BITS_PER_BYTE 8
213 #define PR_BITS_PER_SHORT 16
214 #define PR_BITS_PER_INT 32
215 #define PR_BITS_PER_INT64 64
216 #define PR_BITS_PER_LONG 32
217 #define PR_BITS_PER_FLOAT 32
218 #define PR_BITS_PER_WORD 64
219 #define PR_BITS_PER_DWORD 64
220 #define PR_BITS_PER_DOUBLE 64
222 #define PR_BITS_PER_BYTE_LOG2 3
223 #define PR_BITS_PER_SHORT_LOG2 4
224 #define PR_BITS_PER_INT_LOG2 5
225 #define PR_BITS_PER_INT64_LOG2 6
226 #define PR_BITS_PER_LONG_LOG2 5
227 #define PR_BITS_PER_FLOAT_LOG2 5
228 #define PR_BITS_PER_WORD_LOG2 6
229 #define PR_BITS_PER_DWORD_LOG2 6
230 #define PR_BITS_PER_DOUBLE_LOG2 6
232 #define PR_ALIGN_OF_SHORT 2
233 #define PR_ALIGN_OF_INT 4
234 #define PR_ALIGN_OF_LONG 4
235 #define PR_ALIGN_OF_INT64 8
236 #define PR_ALIGN_OF_FLOAT 4
237 #define PR_ALIGN_OF_WORD 8
238 #define PR_ALIGN_OF_DWORD 8
239 #define PR_ALIGN_OF_DOUBLE 8
240 #define PR_ALIGN_OF_POINTER 8
242 #define PR_BYTES_PER_WORD_LOG2 3
243 #define PR_BYTES_PER_DWORD_LOG2 3
245 #else /* defined(_M_IX86) || defined(_X86_) */
247 #error unknown processor architecture
249 #endif /* defined(_M_IX86) || defined(_X86_) */
251 #ifndef HAVE_LONG_LONG
252 #define HAVE_LONG_LONG
255 #ifndef NO_NSPR_10_SUPPORT
257 #define BYTES_PER_BYTE PR_BYTES_PER_BYTE
258 #define BYTES_PER_SHORT PR_BYTES_PER_SHORT
259 #define BYTES_PER_INT PR_BYTES_PER_INT
260 #define BYTES_PER_INT64 PR_BYTES_PER_INT64
261 #define BYTES_PER_LONG PR_BYTES_PER_LONG
262 #define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
263 #define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
264 #define BYTES_PER_WORD PR_BYTES_PER_WORD
265 #define BYTES_PER_DWORD PR_BYTES_PER_DWORD
267 #define BITS_PER_BYTE PR_BITS_PER_BYTE
268 #define BITS_PER_SHORT PR_BITS_PER_SHORT
269 #define BITS_PER_INT PR_BITS_PER_INT
270 #define BITS_PER_INT64 PR_BITS_PER_INT64
271 #define BITS_PER_LONG PR_BITS_PER_LONG
272 #define BITS_PER_FLOAT PR_BITS_PER_FLOAT
273 #define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
274 #define BITS_PER_WORD PR_BITS_PER_WORD
276 #define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
277 #define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
278 #define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
279 #define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
280 #define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
281 #define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
282 #define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
283 #define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
285 #define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
286 #define ALIGN_OF_INT PR_ALIGN_OF_INT
287 #define ALIGN_OF_LONG PR_ALIGN_OF_LONG
288 #define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
289 #define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
290 #define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
291 #define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
292 #define ALIGN_OF_WORD PR_ALIGN_OF_WORD
294 #define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
295 #define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
296 #define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
298 #endif /* NO_NSPR_10_SUPPORT */
300 #endif /* nspr_cpucfg___ */